import Vue from 'vue'
import store from './store'
import App from './App'
import api from './api'

const msg = (title, duration=1500, mask=false, icon='none') => {
	// 统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}

const success = (title, duration=1500) => {
	// 统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	let mask = false
	let icon = 'success'
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}

const error = (title, duration=1500) => {
	// 统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	let mask = false
	let icon = 'error'
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}

Vue.config.productionTip = false
Vue.prototype.$fire = new Vue();
Vue.prototype.$store = store;
Vue.prototype.$api = api;
Vue.prototype.$tool = {msg, success, error};

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()